﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Mvc;
using JLL.China.Application;
using JLL.China.Web.Areas.Portal.Models;
using JLL.China.Web.Libraries;
using JLL.China.Infrastructure.Services;
namespace JLL.China.Web.Areas.Portal.Controllers
{
    public class ResearchesController : ContentController
    { //
        // GET: /Portal/News/
        public ResearchesController()
        {
            ViewData["now_controller"] = "Portal/Researches/";
            ViewData["TitleEvent"] = "Researches";
        }
        public ActionResult Index(int? id, int? page)
        {
            if (Session["page_size_default"] != null)
            {
                ViewData["per-page"] = Session["page_size_default"].ToString();
                defaultPageSize = Int32.Parse(Session["page_size_default"].ToString());
            }
            else
            {
                ViewData["per-page"] = defaultPageSize;
            }
            int currentPageIndex = page.HasValue ? page.Value : 1;
            //Strore Session
            Session["heading"] = "Manage Researches ";
            Session["pageindex"] = currentPageIndex;

            var portalmodel = new JLL.China.Web.Areas.Portal.Models.PortalModel();
            portalmodel.CategoryID = 2;
            var model = portalmodel.GetReseach().ToPagedList(currentPageIndex, defaultPageSize);
//            ViewData["newscount"] = model.Count;
//            Session["newscount"] = model.Count;
            return View("../Content/Index", model);
        }
      
    }
}
